package model.inventory;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import model.publics.Supplier;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;


@Entity
@Table(name="mst_item_supplier",schema="inventory")
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
public class ItemSupplier  implements java.io.Serializable {

    private ItemSupplierId id;
    private Supplier supplier;
    private Item item;
    private Boolean aktive;
    private Boolean select;

    public ItemSupplier() {
        this.id = new ItemSupplierId();
        this.select = false;
    }
	
    public ItemSupplier(ItemSupplierId id) {
        this.id = id;
        this.select = false;
    }

    public ItemSupplier(ItemSupplierId id, Boolean aktive) {
        this.id = id;
        this.aktive = aktive;
    }
       
    @EmbeddedId
    @AttributeOverrides( {
        @AttributeOverride(name="itemId", column=@Column(name="item_id", nullable=false) ), 
        @AttributeOverride(name="supplierId", column=@Column(name="supplier_id", nullable=false) ) } )
    public ItemSupplierId getId() {
        return this.id;
    }
    
    public void setId(ItemSupplierId id) {
        this.id = id;
    }
    
    @Column(name="aktive")
    public Boolean getAktive() {
        return this.aktive;
    }
    
    public void setAktive(Boolean aktive) {
        this.aktive = aktive;
    }

    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="supplier_id", nullable=false, insertable=false, updatable=false)
    public Supplier getSupplier() {
        return supplier;
    }

    public void setSupplier(Supplier supplier) {
        this.supplier = supplier;
    }

    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="item_id", nullable=false, insertable=false, updatable=false)
    public Item getItem() {
        return item;
    }

    public void setItem(Item item) {
        this.item = item;
    }

    @Transient
    public Boolean isSelect() {
        return select;
    }

    public void setSelect(Boolean select) {
        this.select = select;
    }
    
    
    

}


